import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import state from './state'
import mutations from './mutations'
import createLogger from 'vuex/dist/logger'
import homeModule from '@/views/home/store'
import topicModule from '@/views/topic/store'
import loginModule from '@/views/login/store'
import userModule from '@/views/user/store'
import commentModule from '@/components/comment-list/store'
import projectModule from '@/views/project/store'
import archiveModule from '@/views/archive/store'
import aboutModule from '@/views/about/store'
import messageModule from '@/views/message/store'
import searchModule from '@/views/search/store'

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production'

export const createStore = () => new Vuex.Store({
  namespaced: true,
  actions,
  getters,
  state,
  mutations,
  strict: debug,
  // plugins: debug ? [createLogger()] : [],
  modules: {
    home: homeModule,
    topic: topicModule,
    login: loginModule,
    user: userModule,
    comment: commentModule,
    project: projectModule,
    archive: archiveModule,
    about: aboutModule,
    message: messageModule,
    search: searchModule
  }
})
